//聚好款-首页
function jhk_i() {
    let mockData = Mock.mock({
        'themelist|4': [{
            'img': '@image(285x165, #FFC0CB)',
            'id|+1': 1,
        }],
        'prolist|8': [{
            'img': '@image(255x255, #FFC0CB)',
            'title': '@ctitle(10, 15)',
            'id|+1': 1,
            'price|50-100': 1,
        }],
        'shoplist|3': [{
                'name': '@ctitle(10, 15)',
                'location': '南京市希尔顿酒店南门',
                'prolist|3': [{
                    'id': 1,
                    'img': '@image(106x123, #FFC0CB)',
                    'price|50-100': 1,
                }],
                'lovecount|1-9.1': 1,
            }]
            /*,
                    "bannerlist": [{
                        "picUrl": "@image('1920x360',#FFC0CB)",
                        "href": "#",
                    }, {
                        "picUrl": "@image('1920x360',#dFC0aB)",
                        "href": "#",
                    }, {
                        "picUrl": "@image('1920x360',#aFCdCB)",
                        "href": "#",
                    }],*/
    });
    new Vue({
        el: "#jhk_i",
        data() {
            return {
                bannerlist: null,
                themelist: null,
                prolist: [],
                shoplist: [],
                location:urlParam.location()
            }
        },
        methods: {
            getData() {
                /*this.themelist = mockData.themelist;
                this.bannerlist = mockData.bannerlist;
                this.prolist = mockData.prolist;
                this.shoplist = mockData.shoplist;*/

                var that = this;
                //this.bannerlist = mockData.bannerlist;
                //获取一级广告
                axios.get(urlParam.domain() + '/api/advert/list', {
                    params: {
                        position: urlParam.jhaokuangPosition()
                    }
                }).then(function(response) {
                    if (response.data.code == 1) {
                        if (response.data.data != undefined) {
                            that.bannerlist = response.data.data;
                             console.log(response.data.data);
                        }
                    }
                });

                //获取主题广告
                axios.get(urlParam.domain() + '/api/advert/list', {
                    params: {
                        position: urlParam.jhaokuangThemePosition()
                    }
                }).then(function(response) {
                    if (response.data.code == 1) {
                        if (response.data.data != undefined) {
                            that.themelist = response.data.data;
                            console.log(response.data.data);
                        }
                    }
                });
                //获取精品推荐列表
                axios.get(urlParam.domain() + '/api/shop/goods/list', {
                    params: {
                        pageSize: 8,
                        pageNo: 1
                    }
                }).then(function(response) {
                    if (response.data.code == 1) {
                        if (response.data.data != undefined) {
                            that.prolist = response.data.data.list;
                        }
                    }
                });
                //获取知名店铺
                axios.get(urlParam.domain() + '/api/company/company/famousList', {

                    }

                ).then(function(response) {
                    if (response.data.code == 1) {
                        if (response.data.data != undefined) {
                            that.shoplist = response.data.data;
                            // console.log(response.data.data);
                        }
                    }
                });
            }
        },
        created() {
            this.getData();
        },
        components: {
            'common-swiper': common_swiper,
            'common-biaoti': common_biaoti,
            'base-pro-list': base_pro_list
        }
    });
}

// 聚好款-店铺首页
function jhk_shop_i() {
    let mockData = Mock.mock({
        "topBanner": "@image(1920x150,@color)",
        "navList|4-6": [{
            "text": "@ctitle(2,6)",
            "href": "#"
        }],
        /*'prolist|8': [{
            'img': '@image(255x255, #FFC0CB)',
            'title': '@ctitle(10, 15)',
            'id|+1': 1,
            'price|50-100': 1,
            'mincount|50-100': 1,
        }],
        "bannerlist": [{
            "picUrl": "@image('1920x540',#FFC0CB)",
            "href": "#",
        }, {
            "picUrl": "@image('1920x540',#dFC0aB)",
            "href": "#",
        }, {
            "picUrl": "@image('1920x540',#aFCdCB)",
            "href": "#",
        }],*/
    });
    new Vue({
        el: "#jhk_shop_i",
        data() {
            return {
                bannerlist: null,
                prolist: [],
                navList:[
                    {
                        "text": "首页",
                        "href": ""
                    },
                    {
                        "text": "供应产品",
                        "href": "#"
                    },
                ],
                pageNo: 1,
                total: 0,
                mark: 1,
                companyId: 2,
                companyName:'',//店铺名称
                followId:'',//关注id
                follow:{//顶部 关注状态
                    id:"",//企业id
                    cur:null,//是否已关注 状态 null 未关注 非null 已关注
                },
            }
        },
        methods: {
            getData() {
                var that = this;
                this.topBanner = mockData.topBanner; //顶部通栏 banner
                // this.navList = mockData.navList; //顶部导航
                //this.bannerlist = mockData.bannerlist;
                //获取广告
                // axios.get(urlParam.domain() + '/api/advert/list', {
                //     params: {
                //         position: urlParam.jhaokuangShopPosition()
                //     }
                // }).then(function(response) {
                //     if (response.data.code == 1) {
                //         if (response.data.data != undefined) {
                //             that.bannerlist = response.data.data;
                //             console.log("加载banner");
                //         }
                //     }
                // });

                axios.get(urlParam.domain() + '/api/shop/goods/selectListByCompanyId/', {
                    params: {
                        companyId: that.companyId,
                        pageNo: that.pageNo,
                        pageSize: 8,
                        token: urlParam.token()
                    }
                }).then(function(response) {
                    console.log(response.data.data.company)
                    console.log(response.data.data.pageData);
                    that.prolist = response.data.data.pageData.list;
                    that.companyName = response.data.data.company.name;//店铺名称
                    that.follow.id = response.data.data.company.id;
                    that.follow.cur = response.data.data.company.followId;
                    /*  if(that.mark==1){
                          that.list = response.data.data.map.thisWeekList;
                      }else{
                          that.list = response.data.data.map.preWeekList;
                      }*/
                    that.total = getPageCount(response.data.data.pageData.total, 8);
                });
            },
            /*listen: function(data) {
                // 翻页事件
                alert('当前页码：' + data);
            },*/
            getPage(page) {
                this.pageNo = page;

                this.getData();
            },
            getList(msg, event) {
                this.mark = msg;
                this.ordertype_cur = msg - 1;
                this.getData();
            }
        },
        created() {
            var reqParams = globalAPI.getRequest();
            console.log(reqParams)
            if(reqParams){
                // this.orderType = reqParams.orderType;
                this.companyId = reqParams.companyId;
            }
            this.getData();
        },
        components: {
            'common-swiper': common_swiper,
            'base-pro-list': base_pro_list
        }
    });
}

//聚好款-主题馆
function jhk_theme() {
    let mockData = Mock.mock({
        /*'prolist|8': [{
            'img': '@image(255x255, #FFC0CB)',
            'title': '@ctitle(10, 15)',
            'id|+1': 1,
            'price|50-100': 1,
            'mincount|50-100': 1,
        }],
        "bannerlist": [{
            "picUrl": "@image('1920x540',#FFC0CB)",
            "href": "#",
        }, {
            "picUrl": "@image('1920x540',#dFC0aB)",
            "href": "#",
        }, {
            "picUrl": "@image('1920x540',#aFCdCB)",
            "href": "#",
        }],*/
    });
    new Vue({
        el: "#jhk_theme",
        data() {
            return {
                bannerlist: null,
                prolist: [],
                pageNo: 1,
                total: 0,
                mark: 1,
                categoryId: 2
            }
        },
        methods: {
            getData() {
                var that = this;
                // this.categoryId = window.location.href.split("?")[1];
                console.log(this.categoryId)
                    //this.bannerlist = mockData.bannerlist;
                    //获取广告
                axios.get(urlParam.domain() + '/api/advert/list', {
                    params: {

                    }
                }).then(function(response) {
                    if (response.data.code == 1) {
                        if (response.data.data != undefined) {
                            // that.bannerlist = response.data.data;
                            // console.log("加载banner");
                        }
                    }
                });

                axios.get(urlParam.domain() + '/api/shop/goods/selectListByCategoryId', {
                    params: {
                        categoryId: this.categoryId,
                        pageNo: that.pageNo,
                        pageSize: 8
                    }
                }).then(function(response) {
                    // console.log(response.data.data.company)
                    // console.log(response.data.data.pageData);
                    that.prolist = response.data.data.pageData.list;
                    that.total = getPageCount(response.data.data.pageData.total, 8);
                });
            },
            /*listen: function(data) {
                // 翻页事件
                alert('当前页码：' + data);
            },*/
            getPage(page) {
                this.pageNo = page;

                this.getData();
            },
            getList(msg, event) {
                this.mark = msg;
                this.ordertype_cur = msg - 1;
                this.getData();
            }
        },
        created() {
            console.log(1);
            var reqParams = globalAPI.getRequest();
            console.log(reqParams)
            if(reqParams){
                // this.orderType = reqParams.orderType;
                this.categoryId = reqParams.categoryId;
            }
            this.getData();
        },
        components: {
            'common-swiper': common_swiper,
            'base-pro-list': base_pro_list
        }
    });
}

//聚好款-产品列表
function jhk_pro_list() {
    let mockData = Mock.mock({
        /*  'prolist|8': [{
            'img': '@image(255x255, #FFC0CB)',
            'title': '@ctitle(10, 15)',
            'id|+1': 1,
            'price|50-100': 1,
            'mincount|50-100': 1,
        }],
        'catelist': [{
            'catename': 'fenlei',
            'title': '分类',
            'arr|5': [{
                'txt': '@ctitle(2,4)',
                'val|+1': 1,
            }]
        }, {
        'catename': 'fengge',
            'title': '风格',
            'arr|8': [{
            'txt': '@ctitle(2,4)',
            'val|+1': 1,
        }]
    }],*/
    });
    new Vue({
        el: "#jhk_pro_list",
        data() {
            return {
                catelist: [],
                prolist: [],
                pageNo: 1,
                total: 0,
                minprice: '',
                maxprice: '',
                minNum1: '',
                categoryId: '',
                valueName: '',
                // 筛选条件
                where: {
                    cateobj: {}, //所有类目
                    mincount: '', //起批量
                    minprice: '', //最低价
                    maxprice: '' //最高价
                }
            }
        },
        methods: {
            getData() {
                var that = this;
                /*
                    this.prolist = mockData.prolist;
                    this.catelist = mockData.catelist; //分类搜索-所有类目*/

                axios.get(urlParam.domain() + '/api/shop/goods/proList', {
                    params: {}
                }).then(function(response) {
                    console.log(response.data.data);
                    that.catelist = response.data.data;
                });

                axios.get(urlParam.domain() + '/api/shop/goods/list', {
                    params: {
                        pageNo: that.pageNo,
                        pageSize: 8,
                        minprice: that.minprice,
                        maxprice: that.maxprice,
                        minNum1: that.minNum1,
                        categoryId: that.categoryId,
                        valueName: that.valueName
                    }
                }).then(function(response) {
                    /*console.log(response.data.data.list)*/
                    that.prolist = response.data.data.list;
                    that.total = getPageCount(response.data.data.total, 8);
                });


            },
            /*  listen(data) {
                  // 翻页事件
                  alert('当前页码：' + data);
              },*/
            getPage(page) {
                this.pageNo = page;

                this.getData();
            },
            getwhere(obj) {
                this.where = obj;
                /*alert("分类：" + JSON.stringify(this.where.cateobj.fenlei))
                alert("风格：" + JSON.stringify(this.where.cateobj.fengge))*/

                var a = JSON.stringify(parseInt(obj.minprice));
                var b = JSON.stringify(parseInt(obj.maxprice));
                var c = JSON.stringify(parseInt(obj.mincount));

                var d = JSON.stringify(parseInt(obj.cateobj.fenlei));
                var e = JSON.stringify(parseInt(obj.cateobj.fengge));

                console.log(d)
                console.log(e)
                if (a == 'null') {
                    a = '';
                }
                if (b == 'null') {
                    b = '';
                }
                if (c == 'null') {
                    c = '';
                }
                if (d == 'null') {
                    d = '';
                }
                if (e == 'null') {
                    e = '';
                }
                this.minprice = a;
                this.maxprice = b;
                this.minNum1 = c;
                this.categoryId = d;
                this.valueName = e;
                this.getData();

            },
            // 设置分类筛选的初始条件
            initWhere() {
                let cateobj = {};
                for (let i = 0; i < this.catelist.length; i++) {
                    cateobj[this.catelist[i].catename] = '';
                }
                this.where.cateobj = cateobj;
            }
        },
        created() {
            this.getData();
            this.initWhere();
        },
        components: {
            'base-pro-list': base_pro_list,
            'shaixuan-bar': shaixuan_bar
        }
    });
}

//聚好款-供应商列表
function jhk_sj_list() {
    let mockData = Mock.mock({
        /*'list|6': [{
            'sjname': '@ctitle(10, 15)',
            'shopname': '@ctitle(10, 15)',
            'location': '江苏 常熟市 沙家滨镇沙南路73号',
            'prolist|3': [{
                'id': 1,
                'img': '@image(150x148, #FFC0CB)',
                'price|50-100': 1,
            }],
            'yuangong|400-500': 1,
        }],*/
    });
    new Vue({
        el: "#jhk_sj_list",
        data() {
            return {
                list: [],
                items: [],
                selected: '',
                pageNo: 1,
                fruit: '',
                total: 0,
                provinceId: '-1',
                cityId: '-1',
                employeesType: '-1',
                provinceList: [],
                cityList: [],
                location: urlParam.location()
            }
        },
        watch: {
            provinceId: function(val1) { //此处不要使用箭头函数
                /*console.log(val1)*/
                this.provinceId = val1;
                /*this.city(val1);*/
                this.getData();
            },
            cityId: function(val2) {
                /*  console.log(val2);*/
                this.cityId = val2;
                this.getData();
            },
            employeesType: function(val) {
                /*console.log(this.shengActive)
                console.log(val)*/
                this.employeesType = val;
                this.getData();
            }
        },
        methods: {
            getData() {
                var that = this;
                axios.get(urlParam.domain() + '/api/company/company/selectCompanyAndGoods', {
                    params: {
                        pageNo: that.pageNo,
                        pageSize: 8,
                        provinceId: that.provinceId,
                        cityId: that.cityId,
                        employeesType: that.employeesType
                    }
                }).then(function(response) {
                    console.log(response.data.data.list)
                    that.list = response.data.data.list;
                    that.total = getPageCount(response.data.data.total, 8);
                });

                axios.get(urlParam.domain() + '/api/area/provinceList', {
                    params: {}
                }).then(function(response) {
                    that.provinceList = response.data;
                });

                axios.get(urlParam.domain() + '/api/area/cityList', {
                    params: {
                        id: that.provinceId
                    }
                }).then(function(response) {
                    /* console.log(response.data)*/
                    that.cityList = response.data;
                });
            },
            /*listen(data) {
                // 翻页事件
                alert('当前页码：' + data);
            },*/
            getPage(page) {
                this.pageNo = page;

                this.getData();
            },
            getList(msg, event) {
                this.mark = msg;
                this.ordertype_cur = msg - 1;
                this.getData();
            }
        },
        created() {
            this.getData();
        }
    });
}

//聚好款_商品详情
function jhaokuan_goods_details() {
    let mockData = Mock.mock({
        "topBanner": "@image(1920x150,@color)",
        "navList|4-6": [{
            "text": "@ctitle(2,6)",
            "href": "#"
        }],
        "picList|5": [{
            "fileUrl": "@image(450x450,@color)"
        }],
        "goodsparam|6-9": [{ //商品参数
            "specName": "@ctitle(2,4)",
            "valueName": "@ctitle(6,12)"
        }],
        "data": {
            "code": 1,
            "message": "成功",
            "data": {
                "id": 1,
                "goodsName": "耐克1",
                "goodsPrice": 655, //基础价格
                "goodsNumber": 1122111,
                "companyId": 1,
                "brandId": 1,
                "oneCategoryId": 2,
                "twoCategoryId": 43,
                "categoryId": 61,
                "describe": "冬季新款",
                "ifInvoice": 1,
                "freight": 20,
                "basicGuarantee": "01", //基础保证
                "shelveTime": "2018-01-05 15:55",
                "introduce": "时尚",
                "videoUrl": "localhost://asdasdasdas",
                "picUrl": "http://file.juyihome.com/20171227/pa1.png",
                "company": { //公司
                    "id": 1,
                    "name": "长江纺织",
                },
                "brand": { //品牌
                    "id": 1,
                    "brandName": "微创",
                },
                "picList": [{ //大图下面的小图
                        "id": 416,
                        "fileUrl": "20180108/bb89a760-50ad-495c-a095-659df852c814.png",
                        "outId": 1,
                        "fromType": 2
                    },
                    {
                        "id": 417,
                        "fileUrl": "20180108/bb89a760-50ad-495c-a095-659df852c814.png",
                        "outId": 1,
                        "fromType": 2
                    }
                ],
                "goodsCategory": {
                    "id": 61,
                    "name": "圆领羊毛衫",
                },
                "goodsBteList": [{ //价格 起批量
                        "id": 1,
                        "unitPrice": 650,
                        "goodsId": 1,
                        "minNum": 10,
                        "maxNum": 20,
                        "goodsList": null
                    },
                    {
                        "id": 2,
                        "unitPrice": 640,
                        "goodsId": 1,
                        "minNum": 21,
                        "maxNum": 30,
                        "goodsList": null
                    },
                    {
                        "id": 3,
                        "unitPrice": 630,
                        "goodsId": 1,
                        "minNum": 31,
                        "maxNum": null,
                        "goodsList": null
                    }
                ],
                "goodsSpecValueList": null,
                "goodsSpecAttachments": [{ //颜色
                        "id": 1,
                        "goodsId": 1,
                        "specValueId": null,
                        "picUrl": "http://file.juyihome.com/20171227/pa1.png",
                        "specValue": "白色"
                    },
                    {
                        "id": 2,
                        "goodsId": 1,
                        "specValueId": null,
                        "picUrl": "http://file.juyihome.com/20171227/pa1.png",
                        "specValue": "红色"
                    }
                ],
                "goodsSkuStockList": [{ //颜色 尺寸
                        "id": 1,
                        "goodsId": 1, //商品id
                        "sizeId": 5,
                        "colorId": 2,
                        "basicPrice": 200, //价格
                        "amount": 555, //库存
                        "merchantNumber": 1122233,
                        "commodityBarcode": 2122112231,
                        "spec_value": "s", //尺寸
                        "spec_value2": "白色"
                    },
                    {
                        "id": 2,
                        "goodsId": 1,
                        "sizeId": 6,
                        "colorId": 3,
                        "basicPrice": 300,
                        "amount": 666,
                        "merchantNumber": 1323134,
                        "commodityBarcode": 132132123,
                        "spec_value": "m",
                        "spec_value2": "红色"
                    },
                    {
                        "id": 3,
                        "goodsId": 1,
                        "sizeId": 5,
                        "colorId": 3,
                        "basicPrice": 300,
                        "amount": 666,
                        "merchantNumber": 1323134,
                        "commodityBarcode": 132132123,
                        "spec_value": "s",
                        "spec_value2": "红色"
                    },
                    {
                        "id": 4,
                        "goodsId": 1,
                        "sizeId": 6,
                        "colorId": 2,
                        "basicPrice": 300,
                        "amount": 666,
                        "merchantNumber": 1323134,
                        "commodityBarcode": 132132123,
                        "spec_value": "m",
                        "spec_value2": "白色"
                    }
                ],
                "goodsAttributeAndValueList": [{
                        "id": 1,
                        "goodsId": 1,
                        "attributeId": 13,
                        "attributeValueId": 58,
                        "tspecName": "材质",
                        "tvalueName": "棉"
                    },
                    {
                        "id": 2,
                        "goodsId": 1,
                        "attributeId": 35,
                        "attributeValueId": 89,
                        "tspecName": "颜色",
                        "tvalueName": "红"
                    },
                    {
                        "id": 3,
                        "goodsId": 1,
                        "attributeId": 19,
                        "attributeValueId": 56,
                        "tspecName": "纽扣",
                        "tvalueName": "圆型"
                    },
                    {
                        "id": 4,
                        "goodsId": 1,
                        "attributeId": 45,
                        "attributeValueId": 109,
                        "tspecName": "风格",
                        "tvalueName": "简约"
                    }
                ],
                "num": 1,
                "provinceId": 110000,
                "province": {
                    "id": 110000,
                    "areaname": "北京",
                    "children": null
                },
                "cityId": 110100,
                "remarks": "去哪儿玩",
                "goodsStock": 1,
                "city": {
                    "id": 110100,
                    "areaname": "北京市",
                    "children": null
                },
                "unitPrice": 650,
                "minNum": 2,
                "userId": null,
                "companyName": "长江纺织",
            }
        }
    });

    jhaokuan_goods_details = new Vue({
        el: "#jhaokuan_goods_details",
        data() {
            return {
                follow:{//顶部 关注状态
                    id:"",//企业id
                    cur:null,//是否已关注 状态 null 未关注 非null 已关注
                },
                navList:[
                    {
                        "text": "首页",
                        "href": ""
                    },
                    {
                        "text": "供应产品",
                        "href": "#"
                    },
                ],
                //路径导航
                crumblist: [{
                    text: "首页",
                    href: "#"
                }],
                topBanner: "", //顶部通栏 banner
                goodsShowBig: "", //展示的大图
                goodsShow: [{ fileUrl: "" }], //商品展示图 大图下面的小图
                goodsShowIndex: 0, //大图对应的 商品展示图 初始为第一个

                goodsName: "", //商品名称
                goodsBteList: [{ //价格 起批量
                    "unitPrice": 0,
                    "minNum": 0,
                    "maxNum": 0,
                }],
                goodsPrice: 0, //基础价格
                showPrice: 0, //在尺码中 显示的价格 初始为基础价格 到达起批量之后 阶梯式价格 买的越多越便宜

                colorCur: 0, //选中的颜色 初始状态为第一个
                buyParam: [{ //颜色图片 尺码 等 购买时的参数
                    specValue: "", //颜色
                    picUrl: "", //颜色图片
                    sizeList: [{
                        spec_value: "", //尺码
                        amount: 0, //库存 可售的数量
                        buyAmount: 0, //用户购买的数量
                    }, ]
                }],
                goodsStartNum: 1, //起批量
                goodsTotalNum: 0, //选购的总量
                goodsTotalPrice: 0, //总价
                goodsTotalShow: 0, //控制 已选清单 下拉框 0隐藏 1显示
                basicGuarantee: "", //基础保证 0 正品保证 1 极速退款 2 七天无理由退货

                gid:'',//商品id
                collectingId:null,//收藏id
                goodsparam: [], //商品参数
                describe:'',//商品描述
                companyName:'',//店铺名称
                followId:'',//关注id
                location: urlParam.location(),//本地路径
                htmlCode: "<div>html代码</div>", //传入用户编辑的html代码 测试用，通入接口后删除

                viewChange: { //用于更新页面
                    data: 0,
                }
            }
        },
        methods: {
            getData() {
                this.topBanner = mockData.topBanner; //顶部通栏 banner

                // this.navList = mockData.navList; //顶部导航
                // this.goodsShow = mockData.picList; //商品展示图 大图下面的小图
                // this.goodsShowBig = this.goodsShow[0].fileUrl; //初始状态，显示第一个图
                // this.goodsPrice = mockData.data.data.goodsPrice; //基础价格
                // this.showPrice = this.goodsPrice; //初始状态显示的价格为 基础价格
                // this.goodsBteList = mockData.data.data.goodsBteList; //价格 起批量
                // this.goodsStartNum = this.goodsBteList[0].minNum; //起批量

                //购买时的参数 需要根据ajax得到的数据 处理后得到
                // this.buyParam = mockData.data.data.goodsSpecAttachments;
                // var sizeParam = mockData.data.data.goodsSkuStockList; //简写
                // for (var i = 0; i < this.buyParam.length; i++) {
                //     this.buyParam[i].sizeList = []; //尺码
                //     var sizeList = this.buyParam[i].sizeList; //简写
                //     for (var j = 0; j < sizeParam.length; j++) { //循环 尺码数组 将对应颜色的尺码 添加到对应颜色的数组中 生成颜色包含对应尺码的数组
                //         if (this.buyParam[i].specValue == sizeParam[j].spec_value2) {
                //             sizeList.push({});
                //             sizeList[sizeList.length - 1].spec_value = sizeParam[j].spec_value; //价格
                //             sizeList[sizeList.length - 1].amount = sizeParam[j].amount; //库存 可售的数量 
                //             sizeList[sizeList.length - 1].buyAmount = 0; //用户购买的数量 初始值为0
                //         }
                //     }
                // }

                //this.goodsparam = mockData.goodsparam; //商品参数

                var that = this;
                //请求页面初始数据
                // this.gid = window.location.href.split("?")[1];
                console.log("测试"+that.gid)
                if(that.gid == ''){
                    that.gid = 2;
                }
                console.log(this.gid)
                axios({
                    method: 'get',
                    url: urlParam.domain() + "/api/shop/goods/detail?id=" + that.gid,
                    params: {
                        token: urlParam.token()
                    },
                }).then(function(res) {
                    that.goodsShow = res.data.data.picList; //商品展示图 大图下面的小图
                    that.goodsShowBig = that.goodsShow[0].fileUrl; //初始状态，显示第一个图
                    that.goodsPrice = res.data.data.goodsPrice; //基础价格
                    that.showPrice = that.goodsPrice; //初始状态显示的价格为 基础价格
                    that.goodsName = res.data.data.goodsName; //商品名称
                    that.goodsBteList = res.data.data.goodsBteList; //价格 起批量
                    that.goodsStartNum = that.goodsBteList[0].minNum; //起批量

                    //购买时的参数 需要根据ajax得到的数据 处理后得到
                    that.buyParam = res.data.data.goodsSpecAttachments;
                    var sizeParam = res.data.data.goodsSkuStockList; //简写
                    for (var i = 0; i < that.buyParam.length; i++) {
                        that.buyParam[i].sizeList = []; //尺码
                        var sizeList = that.buyParam[i].sizeList; //简写
                        for (var j = 0; j < sizeParam.length; j++) { //循环 尺码数组 将对应颜色的尺码 添加到对应颜色的数组中 生成颜色包含对应尺码的数组
                            if (that.buyParam[i].specValue == sizeParam[j].spec_value2) {
                                sizeList.push({});
                                sizeList[sizeList.length - 1].spec_value = sizeParam[j].spec_value; //价格
                                sizeList[sizeList.length - 1].amount = sizeParam[j].amount; //库存 可售的数量 
                                sizeList[sizeList.length - 1].buyAmount = 0; //用户购买的数量 初始值为0
                            }
                        }
                    }
                    that.basicGuarantee = res.data.data.basicGuarantee; //基础保证
                    that.gid = res.data.data.id;//商品id
                    that.collectingId = res.data.data.num;//收藏id
                    that.goodsparam = res.data.data.goodsAttributeAndValueList;//商品参数
                    that.describe = res.data.data.describe;//商品描述
                    that.companyName = res.data.data.companyName;//店铺名称
                    that.follow.id = res.data.data.companyId;//企业id
                    that.follow.cur = res.data.data.followId;//关注id

                    console.log(that.location)
                    that.navList[0].href = that.location+'/jhaokuan/shop_i.html?companyId='+that.follow.id;//跳转店铺首页
                    //生成路径导航
                    that.crumblist.push({//商品类别 一级
                        text:res.data.data.goodsCategory1.name,
                        href:"#"
                    });
                    that.crumblist.push({//商品类别 二级
                        text:res.data.data.goodsCategory2.name,
                        href:"#"
                    });
                    that.crumblist.push({//商品类别 三
                        text:res.data.data.goodsCategory.name,
                        href:"#"
                    });
                    that.crumblist.push({//店铺名称
                        text:res.data.data.companyName,
                        href:"#"
                    });
                    console.log(res.data.data)
                }).catch(function(error) {
                    console.log(error);
                });
            },
            //跳转店铺首页
            jumpShopCompany(){
                window.location.href = urlParam.location()+'/jhaokuan/shop_i.html?companyId='+this.follow.id
            },
            delCollecting(_id) {
                if (urlParam.token() == null || urlParam.token() == "") {
                    this.$message({
                        message: "请先登录",
                        type: "warning"
                    });
                    return;
                }
                var that = this;
                axios({
                    method: "post",
                    url: urlParam.domain() + '/api/shop/goodsCollecting/delete',
                    data: {
                        ids: _id + ",",
                        token: urlParam.token()
                    },
                    transformRequest: [function(data) {
                        let ret = ''
                        for (let it in data) {
                            ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                        }
                        return ret
                    }],
                }).then(function(response) {
                    that.getData();
                });
            },
            addCollecting(_id) {
                if (urlParam.token() == null || urlParam.token() == "") {
                    this.$message({
                        message: "请先登录",
                        type: "warning"
                    });
                    return;
                }
                var that = this;
                axios({
                    method: "post",
                    url: urlParam.domain() + '/api/shop/goodsCollecting/addCollecting',
                    data: {
                        token: urlParam.token(),
                        goodsId: _id
                    },
                    transformRequest: [function(data) {
                        let ret = ''
                        for (let it in data) {
                            ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                        }
                        return ret
                    }],
                }).then(function(response) {
                    that.getData();
                });
            },
            //更新页面
            changeView() {
                this.viewChange.data++;
                this.$set(this.viewChange, "data", this.viewChange.data);
            },
            //鼠标进入 商品展示图（小图）
            inGoodsShow(item, index) {
                this.goodsShowBig = item;
                this.goodsShowIndex = index;
            },
            //点击颜色 切换显示尺码
            clickColor(index) {
                this.colorCur = index;
                this.goodsShowBig = this.buyParam[index].picUrl;
            },
            //点击减号
            clickDel(index, subindex) {
                //不能小于0
                if (this.buyParam[index].sizeList[subindex].buyAmount == 0) {
                    return;
                }
                this.buyParam[index].sizeList[subindex].buyAmount--;
                this.calTotal();
                this.changeView();
            },
            //点击加号
            clickAdd(index, subindex) {
                //不能大于库存
                if (this.buyParam[index].sizeList[subindex].buyAmount == this.buyParam[index].sizeList[subindex].amount) {
                    return;
                }
                this.buyParam[index].sizeList[subindex].buyAmount++;
                this.calTotal();
                this.changeView();
            },
            //失去焦点
            blurInput(index, subindex) {
                var num = this.buyParam[index].sizeList[subindex].buyAmount;
                if (!(num - 0)) { //验证是否为数字
                    num = 0;
                } else if (num < 0) { //验证 不能是小于0的数
                    num = 0;
                } else if (num > this.buyParam[index].sizeList[subindex].amount) { //验证 不能大于库存
                    num = this.buyParam[index].sizeList[subindex].amount;
                } else { //取整数
                    num = parseInt(num);
                }
                this.buyParam[index].sizeList[subindex].buyAmount = num;
                this.calTotal();
                this.changeView();
            },
            //计算 总量 总价
            calTotal() {
                var num = 0;
                for (var i = 0; i < this.buyParam.length; i++) {
                    for (var j = 0; j < this.buyParam[i].sizeList.length; j++) {
                        num = num + this.buyParam[i].sizeList[j].buyAmount;
                    }
                }
                this.goodsTotalNum = num; //总量
                //价格 变动
                this.showPrice = this.goodsPrice;
                for (var i = 0; i < this.goodsBteList.length; i++) {
                    if (num >= this.goodsBteList[i].minNum) {
                        this.showPrice = this.goodsBteList[i].unitPrice;
                    }
                }
                this.goodsTotalPrice = num * this.showPrice; //总价
            },
            //点击已选清单 显示下拉框
            clickDetailsList() {
                this.goodsTotalShow == 0 ? this.goodsTotalShow = 1 : this.goodsTotalShow = 0;
            },
            //每种颜色 用户购买的总数
            colorTotal: function(list) {
                var num = 0;
                for (var i = 0; i < list.length; i++) {
                    num += list[i].buyAmount;
                }
                return num;
            },
        },
        created() {
            var reqParams = globalAPI.getRequest();
            console.log(reqParams)
            if(reqParams){
                // this.orderType = reqParams.orderType;
                this.gid = reqParams.id;
                console.log(this.gid);
            }
            this.getData();
        },
        mounted() {

        },
        components: {

        }
    });
}